<template lang="jade">
div.return-bar
	i.iconfont(@click="back()") &#xe668;
	div.limitedname 信息批露


div.aboutus_page.detail_top
	div.top_com_type.cbox.buletype
		div.cl.type
			ul#newsmenu
				li(v-bind:class="{ 'on':type=='1' }", v-on:click="setType('1')") 数据总览
				li(v-bind:class="{ 'on':type=='2' }", v-on:click="setType('2')") 实时运营数据
				li(v-bind:class="{ 'on':type=='3' }", v-on:click="setType('3')") 详细数据图
				li(v-bind:class="{ 'on':type=='4' }", v-on:click="setType('4')") 借款标的情况

	div.d_overview( v-if=" type=='1' " )
		dl.ctbox
			dd
				flexbox
					flexbox-item
						span
							i.iconfont &#xe638;
							em 累计成交(元)
						b {{items.account}}
					flexbox-item.left
						span
							i.iconfont &#xe63e;
							em 待还金额(元)
						b {{items.dhye}}

				flexbox
					flexbox-item
						span
							i.iconfont &#xe638;
							em 已为用户赚取(元)
						b {{items.zqlx}}
					flexbox-item.left
						span
							i.iconfont &#xe63e;
							em 交易笔数(笔)
						b {{items.jkbs}}


				flexbox
					flexbox-item
						span
							i.iconfont &#xe638;
							em 已注册人数(人)
						b {{items.zcrs}}
					flexbox-item.left
						span
							i.iconfont &#xe63e;
							em 人均累计投资(元)
						b {{items.avg_tender}}

	div.d_intime( v-if=" type=='2' " )
		dl.ctbox
			dd
				flexbox
					flexbox-item.right
						b {{items.cjl}}
						span 成交量(元)
						i.iconfont(v-bind:class="{ 'up':items.cjl_status==1, 'down':items.cjl_status==2 }") &#xe61f;
					flexbox-item
						b {{items.zjlr}}
						span 资金净流入(元)
						i.iconfont(v-bind:class="{ 'up':items.zjlr_status==1, 'down':items.zjlr_status==2 }") &#xe61f;

				flexbox
					flexbox-item.right
						b {{items.dhye}}
						span 待还余额(元)
						i.iconfont(v-bind:class="{ 'up':items.dhye_status==1, 'down':items.dhye_status==2 }") &#xe61f;
					flexbox-item
						b {{items.syl}}
						span 平均收益率(%)
						i.iconfont(v-bind:class="{ 'up':items.syl_status==1, 'down':items.syl_status==2 }") &#xe61f;


				flexbox
					flexbox-item.right
						b {{items.dkqx}}
						span 平均借款期限(月)
						i.iconfont(v-bind:class="{ 'up':items.dkqx_status==1, 'down':items.dkqx_status==2 }") &#xe61f;
					flexbox-item
						b {{items.tenderMember}}
						span 投资人数(人)
						i.iconfont(v-bind:class="{ 'up':items.tenderMember_status==1, 'down':items.tenderMember_status==2 }") &#xe61f;


				flexbox
					flexbox-item.right
						b {{items.avg_tender}}
						span 人均投资金额(元)
						i.iconfont(v-bind:class="{ 'up':items.avg_tender_status==1, 'down':items.avg_tender_status==2 }") &#xe61f;
					flexbox-item
						b {{items.tzje}}
						span 待收投资人数(人)
						i.iconfont(v-bind:class="{ 'up':items.tzje_status==1, 'down':items.tzje_status==2 }") &#xe61f;

				flexbox
					flexbox-item.right
						b {{items.jkrs}}
						span 借款人数(人)
						i.iconfont(v-bind:class="{ 'up':items.jkrs_status==1, 'down':items.jkrs_status==2 }") &#xe61f;
					flexbox-item
						b {{items.avg_money}}
						span 人均借款金额(元)
						i.iconfont(v-bind:class="{ 'up':items.avg_money_status==1, 'down':items.avg_money_status==2 }") &#xe61f;

				flexbox
					flexbox-item.right
						b {{items.jkbs}}
						span 借款标数(个)
						i.iconfont(v-bind:class="{ 'up':items.jkbs_status==1, 'down':items.jkbs_status==2 }") &#xe61f;
					flexbox-item
						b {{items.dhjk}}
						span 待还借款人数(人)
						i.iconfont(v-bind:class="{ 'up':items.dhjk_status==1, 'down':items.dhjk_status==2 }") &#xe61f;



	div( v-if=" type=='3' " )

		div.selectdate

			flexbox
				flexbox-item
					请选择日期(按月显示)
				flexbox-item(style="padding:0.1rem 0rem;text-align:right;position:relative;")
					{{cdate}}
					input(type="month",v-model="date2", v-on:change="setDate2")

		div#echarts-line1.charts.mb10
		div#echarts-line2.charts.mb10
		div#echarts-line3.charts

	div.rank( v-if=" type=='4' " )
		div.float
			div.p1
				div.red.con
					div.ct
						span 至今己帮助借款人
						b {{items.project_1}}个

			div.p2
				div.yellow.con
					div.ct
						span 待还总额
						b {{items.project_4}}元

			div.p3
				div.blue.con
					div.ct
						span 逾期
						b {{items.project_5}}元

			div.p4
				div.purple.con
					div.ct
						span 平均借款
						b {{items.project_3}}元

			div.p5
				div.green.con
					div.ct
						span 人均累计借款
						b {{items.project_2}}元

		dl.ctbox
			dd
				flexbox
					flexbox-item.right
						span 项目逾期率
						b {{items.project_6}}%
					flexbox-item
						span 金额逾期率
						b {{items.project_7}}%
					flexbox-item
						span 逾期项目
						b {{items.project_8}}个

				flexbox
					flexbox-item.right
						span 车贷项目逾率
						b {{items.project_9}}%

					flexbox-item
						span 车贷金额逾期率
						b {{items.project_10}}%

					flexbox-item
						span 楼贷项目逾期率
						b {{items.project_11}}%

				flexbox
					flexbox-item.right
						span 楼贷金额逾期率
						b {{items.project_12}}%

					flexbox-item
						span 历史项目逾期
						b {{items.project_13}}元

					flexbox-item
						span 历史项目逾期率
						b {{items.project_14}}%

				flexbox
					flexbox-item.right
						span 累计逾期代偿
						b {{items.project_15}}元

					flexbox-item
						span 累计逾期代偿
						b {{items.project_16}}笔

					flexbox-item
						span 最大单户融资余额占比
						b {{items.project_17}}%

				flexbox
					flexbox-item.right
						span 最大十户融资余额占比
						b {{items.project_18}}%

					flexbox-item
					flexbox-item



</template>

<style>
@import '~vux/dist/vux.css';
</style>

<script>
import echarts from 'echarts'
import '../../assets/sass/detail/aboutus.scss'
import { Calendar, Group, Flexbox, FlexboxItem} from 'vux'
import {c_analysis_intime, c_analysis_overview, c_analysis_project, c_chart} from '../../config/api'

var date = new Date;
export default{

	data(){
		return{
			type:'1',
			items:[],
			cdate:'TODAY',

			weeksList:['日', '一', '二', '三', '四', '五', '六 '],
			//this.cdate = this.getDate();
	        // 初始化空对象
	        chart: null,
	        // 初始化图表配置
	        opinion: ['高富帅', '矮富帅', '高富挫', '矮富挫', '女生'],
	        opinionData: [{
	            value: 26,
	            name: '高富帅'
	        }, {
	            value: 31,
	            name: '矮富帅'
	        }, {
	            value: 18,
	            name: '高富挫'
	        }, {
	            value: 28,
	            name: '矮富挫'
	        }, {
	            value: 21,
	            name: '女生'
	        }],

	        chartOpts:{
	        	//echarts-line2
	        	'vs_tjr': {'name': 'vs', 'legend': ['投资人数', '借款人数'], 'params': [1, 5, 6], 'type': ['line', 'line'], 'index': [0, 1], 'sel':[1,2,3],'xtime':'','unin':['','人','','人']},

	        	//echarts-line1
        		'jc_cjl': {'name': 'jc', 'legend': ['成交量'], 'params': [1, 1, 0], 'type': ['bar'], 'sel':[1,2,3],'xtime':'','unin':['','万元','','']},

        		//echarts-line3
				'sd_zj': {'name': 'sd', 'legend': ['资金净流入', '当日待还余额', '当日待还余额(30日平均)'], 'params': [1, 4, 3], 'type': ['line', 'line', 'line'], 'index': [0, 1, 1], 'sel':[1],'xtime':'','unin':['','万元','','万元']}
	        },

			theme:{
			    color: ["#2ec7c9", "#b6a2de", "#5ab1ef", "#ffb980", "#d87a80", "#8d98b3", "#e5cf0d", "#97b552", "#95706d", "#dc69aa", "#07a2a4", "#9a7fd1", "#588dd5", "#f5994e", "#c05050", "#59678c", "#c9ab00", "#7eb00a", "#6f5553", "#c14089"],
			    title: {
			        textStyle: {
			            fontWeight: "normal",
			            color: "#008acd"
			        }
			    },
			    dataRange: {
			        itemWidth: 15,
			        color: ["#5ab1ef", "#e0ffff"]
			    },
			    toolbox: {
			        color: ["#1e90ff", "#1e90ff", "#1e90ff", "#1e90ff"],
			        effectiveColor: "#ff4500"
			    },
			    tooltip: {
			        backgroundColor: "rgba(50,50,50,0.5)",
			        axisPointer: {
			            type: "line",
			            lineStyle: {
			                color: "#008acd"
			            },
			            crossStyle: {
			                color: "#008acd"
			            },
			            shadowStyle: {
			                color: "rgba(200,200,200,0.2)"
			            }
			        },
			        padding: 10
			    },
			    dataZoom: {
			        dataBackgroundColor: "#efefff",
			        fillerColor: "rgba(182,162,222,0.2)",
			        handleColor: "#008acd"
			    },
			    grid: {
			        borderColor: "#eee"
			    },
			    categoryAxis: {
			        axisLine: {
			            lineStyle: {
			                color: "#008acd"
			            }
			        },
			        splitLine: {
			            lineStyle: {
			                color: ["#eee"]
			            }
			        }
			    },
			    valueAxis: {
			        axisLine: {
			            lineStyle: {
			                color: "#008acd"
			            }
			        },
			        splitArea: {
			            show: true,
			            areaStyle: {
			                color: ["rgba(250,250,250,0.1)", "rgba(200,200,200,0.1)"]
			            }
			        },
			        splitLine: {
			            lineStyle: {
			                color: ["#eee"]
			            }
			        }
			    },
			    polar: {
			        axisLine: {
			            lineStyle: {
			                color: "#ddd"
			            }
			        },
			        splitArea: {
			            show: true,
			            areaStyle: {
			                color: ["rgba(250,250,250,0.2)", "rgba(200,200,200,0.2)"]
			            }
			        },
			        splitLine: {
			            lineStyle: {
			                color: "#ddd"
			            }
			        }
			    },
			    timeline: {
			        lineStyle: {
			            color: "#008acd"
			        },
			        controlStyle: {
			            normal: {
			                color: "#008acd"
			            },
			            emphasis: {
			                color: "#008acd"
			            }
			        },
			        symbol: "emptyCircle",
			        symbolSize: 3
			    },
			    bar: {
			        itemStyle: {
			            normal: {
			                barBorderRadius: 5
			            },
			            emphasis: {
			                barBorderRadius: 5
			            }
			        }
			    },
			    line: {
			        smooth: true,
			        symbol: "circle",
			        symbolSize: 3
			    },
			    k: {
			        itemStyle: {
			            normal: {
			                color: "#d87a80",
			                color0: "#2ec7c9",
			                lineStyle: {
			                    color: "#d87a80",
			                    color0: "#2ec7c9"
			                }
			            }
			        }
			    },
			    scatter: {
			        symbol: "circle",
			        symbolSize: 4
			    },
			    radar: {
			        symbol: "emptyCircle",
			        symbolSize: 3
			    },
			    map: {
			        itemStyle: {
			            normal: {
			                areaStyle: {
			                    color: "#ddd"
			                },
			                label: {
			                    textStyle: {
			                        color: "#d87a80"
			                    }
			                },
			                borderColor: '#666'
			            },
			            emphasis: {
			                areaStyle: {
			                    color: "#fe994e"
			                }
			            }
			        }
			    },
			    force: {
			        itemStyle: {
			            normal: {
			                linkStyle: {
			                    color: "#1e90ff"
			                }
			            }
			        }
			    },
			    chord: {
			        itemStyle: {
			            normal: {
			                borderWidth: 1,
			                borderColor: "rgba(128, 128, 128, 0.5)",
			                chordStyle: {
			                    lineStyle: {
			                        color: "rgba(128, 128, 128, 0.5)"
			                    }
			                }
			            },
			            emphasis: {
			                borderWidth: 1,
			                borderColor: "rgba(128, 128, 128, 0.5)",
			                chordStyle: {
			                    lineStyle: {
			                        color: "rgba(128, 128, 128, 0.5)"
			                    }
			                }
			            }
			        }
			    },
			    gauge: {
			        axisLine: {
			            lineStyle: {
			                color: [[0.2, "#2ec7c9"], [0.8, "#5ab1ef"], [1, "#d87a80"]],
			                width: 10
			            }
			        },
			        axisTick: {
			            splitNumber: 10,
			            length: 15,
			            lineStyle: {
			                color: "auto"
			            }
			        },
			        splitLine: {
			            length: 22,
			            lineStyle: {
			                color: "auto"
			            }
			        },
			        pointer: {
			            width: 5
			        }
			    },
			    textStyle: {
			        fontFamily: "微软雅黑, Arial, Verdana, sans-serif"
			    }
			}
		}
	},

	watch: {
		cdate: function (val) {
			//console.log('123');
			//document.getElementById('echarts-line1').innerHTML ='';
			//document.getElementById('echarts-line2').innerHTML ='';
			//document.getElementById('echarts-line3').innerHTML ='';
			this.getChart();
		}
	},

	components: {
		Flexbox,
		FlexboxItem,
		Calendar,
		Group
	},


	methods:{
	    setDate2(key){
	    	console.log(key.target.value);
	    	this.cdate = key.target.value
	    },

	    back(){
	      this.$route.router.go('/')
	    },

	    setType(key){
	    	this.type = key;
	    	switch(key){
	    		case "1":
		    		this.fetch();
		    		break;
	    		case "2":
		    		this.intime_fetch();
		    		break;
	    		case "3":
		    		//this.drawGraph('main');
		    		//this.cdate = this.getDate();
		    		//this.cdate = '2017-01-11'
		    		this.cdate = '2017-01-1';
		    		//this.getChart();
		    		break;
	    		case "4":
		    		this.project();
		    		break;
	    	}
	    },

	    intime_fetch() {
	    	this.$store.dispatch('setShowLoading', true);
	      this.$http({url: c_analysis_intime, method: 'GET'}).then(function (response) {
	      	this.items = response.data.data;
	      	this.$store.dispatch('setShowLoading', false);
	      });
	    },



	    project() {
	    	this.$store.dispatch('setShowLoading', true);
	      this.$http({url: c_analysis_project, method: 'GET'}).then(function (response) {
	      	this.items = response.data.data;
	      	this.$store.dispatch('setShowLoading', false);
	      });
	    },



	    fetch() {
	    	this.$store.dispatch('setShowLoading', true);
	      this.$http({url: c_analysis_overview, method: 'GET'}).then(function (response) {
	      	this.items = response.data.data;
	      	this.$store.dispatch('setShowLoading', false);
	      });
	    },

	    getChart(){

	    	this.$store.dispatch('setShowLoading', true);
	      this.$http({url: c_chart+'&date='+this.cdate, method: 'GET'}).then(function (rs) {
	      	//this.items = response.data.data;
	      	var d = rs.data;


			this.chartTJR({
				legend: ['投资人', '借款人'],
				type: ['line', 'line'],
				xAxis: d.date1,
				xtime: '91.5',
				unin:['','人','','人'],
				index: [0, 1],
				datas: [d.bidValue, d.borValue]
			});

			this.chartZT({
				legend: ['资金净流入', '当日待还余额', '当日待还金额(30日平均)'],
				type: ['line', 'line', 'line'],
				xAxis: d.date1,
				unin:['','万元','','万元'],
				xtime: '91.5',
				index: [0, 1, 1],
				datas: [d.netFlowValue, d.moneyStockValue.y1, d.moneyStockValue.y2]
			});


			this.chartZZT({
				legend: ['成交量'],
				type: ['bar'],
				xAxis: d.date1,
				unin:['','万元','',''],
				xtime: '91.5',
				datas: [d.amountValue]
			})
			this.$store.dispatch('setShowLoading', false);
	      	/*
			this.drawGraph('echarts-line1', {
				legend: ['投资人', '借款人'],
				type: ['line', 'line'],
				xAxis: d.date,
				xtime: '91.5',
				unin:['','人','','人'],
				index: [0, 1],
				datas: [d.bidValue, d.borValue]
			});






			/*
       		this.chartZZT({
				legend: ['成交量'],
				type: ['bar'],
				xAxis: d.date,
				unin:['','万元','',''],
				xtime: '91.5',
				datas: [d.amountValue]
			});*/


	      });
	    },



		chartTJR (d) {
			//console.log(d);
			/*if (d.date && d.date.length == 52) {
				if (!d.data2[51]) {
					d.data2[51] = 0;
				}
			}*/
			this.initDetails('echarts-line1', {
				legend: d.legend,
		        type: d.type,
		        dataZoom: {show : true,realtime : true,start : d.xtime,end : 100},
		        index: d.index,
		        xAxis: d.xAxis,
				yAxis: d.unin,
		        data: d.datas
			}, true);
		},

		chartZT (d) {
			if (d.data2 && !d.data2.length) {
				d.datas = [d.data1, d.data2.y1, d.data2.y2]
			}

			this.initDetails('echarts-line3', {
				legend: d.legend,
		        type: d.type,
		        dataZoom: {show : true,realtime : true,start : d.xtime,end : 100},
		        index: d.index,
		        xAxis: d.xAxis,
				yAxis: d.unin,
		        data: d.datas
			}, true);
		},


		chartZZT (d) {
			this.initZZT('echarts-line2', {
				legend: d.legend,
		        legendType: d.type,
		        legendPos: ['', '0px'],
		        isLegendShow: true,
		        dataZoom: {show : true,realtime : true,start : d.xtime,end : 100},
		        xAxis: d.xAxis,
		        yAxis: d.unin,
		        data: d.datas
			}, true);
		},

	    drawGraph(id, opts) {
	    	//console.log(document.getElementById(id))

	    	this.chart = echarts.init(document.getElementById(id))
	    	this.chart.showLoading();
	    	var that = this;

		    var seriesData = [];
		    console.log("drawGraph:")
		    console.log(opts)
		    return;

		    for (var i = 0, length = opts.data.length; i < length; i++) {
		        seriesData[i] = {
		            name: opts.legend[i],
		            type: opts.legendType[i],
		            data: opts.data[i]
		        }

		        if (opts.legendType[i] === "line") {
		            seriesData[i].yAxisIndex = 1
		        }
		    }

            this.chart.setOption({
			    title: {
			        text: '折线图堆叠'
			    },
			    tooltip: {
			        trigger: 'axis'
			    },
			    legend: {
			        data:opts.legend
			    },
			    grid: {
			        left: '3%',
			        right: '4%',
			        bottom: '3%',
			        containLabel: true
			    },
			    toolbox: {
			        feature: {
			            saveAsImage: {}
			        }
			    },
			    xAxis: {
			        type: 'category',
			        boundaryGap: false,
			        data: opts.xAxis
			    },
			    yAxis: {
			        type: 'value'
			    },
			    series: seriesData
			});
            this.chart.hideLoading();
	    },








		initZZT(name, opts, flag) {
		    var charts = this.getEchart(name);

	    	//this.chart = echarts.init(document.getElementById(name))
	    	//this.chart.showLoading();


		    var seriesData = [];
		    /*if (!opts.data) {
		        $("#" + id).hide();
		        return
		    }*/
		    for (var i = 0, length = opts.data.length; i < length; i++) {
		        seriesData[i] = {
		            name: opts.legend[i],
		            type: opts.legendType[i],
		            data: opts.data[i]
		        };
		        if (opts.legendType[i] === "line") {
		            seriesData[i].yAxisIndex = 1
		        }
		    }
		    var option = {
		        tooltip: {
		            trigger: "axis"
		        },
		        calculable: true,
		        legend: {
		            x: opts.legendPos[0] || "right",
		            y: opts.legendPos[1],
		            show: opts.isLegendShow,
		            data: opts.legend
		        },
		        xAxis: [{
		            type: "category",
		            data: opts.xAxis
		        }],
		        grid: opts.grid,
		        dataZoom: opts.dataZoom,
		        yAxis: [{
		            type: "value",
		            name: opts.yAxis[0],
		            boundaryGap: [0, 0.5],
		            axisLabel: {
		                formatter: "{value}" + opts.yAxis[1]
		            }
		        }, {
		            type: "value",
		            name: opts.yAxis[2],
		            axisLabel: {
		                formatter: "{value}" + opts.yAxis[3]
		            }
		        }],
		        series: seriesData
		    };

		    if (flag) {
		    	option.yAxis = [{
		            type: 'value',
		            axisTick: {
		                show: true
		            },
		            axisLine: {
		                show: true
		            },
		            splitLine: {
		                show: false
		            }
		        }, {
		            type: 'value',
		            axisTick: {
		                show: true
		            },
		            axisLine: {
		                show: true
		            },
		            splitLine: {
		                show: false
		            }
		        }]
		    }

		    charts.init(option);
		    //this.chart.hideLoading();
		},

		initDetails(name, opts, flag) {
			var charts = this.getEchart(name);
			//echarts.showLoading();
			var seriesData = [];
			//console.log("initDetails:")
			//console.log(opts);
			//return;
			for (var i = 0, len = opts.data.length; i < len; i++) {
				var item = opts.data[i];
				seriesData[i] = {
		            name: opts.legend[i],
		            type: opts.type[i],
		            yAxisIndex: opts.index[i],
		            symbol: 'emptyCircle',
		            smooth: true,
		            data: item
		        };
			}
			var option = {
		        tooltip: {
		            trigger: 'axis'
		        },
		        legend: {
		            data: opts.legend,
		            x: "right"
		        },
		        dataZoom: opts.dataZoom,

		        grid: {
	        		left: '3%',
	        		right: '5%',
	        		bottom: '8%',
	       			containLabel: true
		        },
		        xAxis: {
		            type: 'category',
		            data: opts.xAxis,
		            axisTick: {
		                show: true
		            },
		            axisLine: {
		                show: true
		            },
		            axisLabel: {
		                margin: 12
		            }
		        },
		        series: seriesData
		    };
			if (flag) {
		    	option.yAxis = [{
		            type: 'value',
		            axisTick: {
		                show: true
		            },
		            axisLine: {
		                show: true
		            },
		            splitLine: {
		                show: false
		            },
					axisLabel: {
		                formatter: "{value}" + opts.yAxis[1]
		            }
		        }, {
		            type: 'value',
		            axisTick: {
		                show: true
		            },
		            axisLine: {
		                show: true
		            },
		            splitLine: {
		                show: false
		            },
					axisLabel: {
		                formatter: "{value}" + opts.yAxis[3]
		            }
		        }]
		    }
		    charts.init(option);
		    //echarts.hideLoading();
		},

		getEchart (name) {
			//console.log(name);
			var chart = echarts.init(document.getElementById(name));
			chart.setTheme(this.theme);
			return {
				init: function (opts) {
					//console.log(opts);
					chart.setOption(opts);
				}
			}
		},

	    /*drawGraph(id) {
	    	console.log(document.getElementById(id))

	    	this.chart = echarts.init(document.getElementById(id))
	    	this.chart.showLoading();
	    	var that = this;

            this.chart.setOption({
			    color: ['#3398DB'],
			    tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
			    grid: {
			        left: '3%',
			        right: '4%',
			        bottom: '3%',
			        containLabel: true
			    },
			    xAxis : [
			        {
			            type : 'category',
			            data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
			            axisTick: {
			                alignWithLabel: true
			            }
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value'
			        }
			    ],
			    series : [
			        {
			            name:'直接访问',
			            type:'bar',
			            barWidth: '60%',
			            data:[10, 52, 200, 334, 390, 330, 220]
			        }
			    ]
			});
            this.chart.hideLoading();
	    }*/
	    getDate(){
	    	var r_val = "", yy="", mm="", dd="";
	    	yy =  date.getFullYear();
	    	mm = parseInt(date.getMonth() +1 );
	    	dd = date.getDate();
	    	if(mm < 10) mm = '0'+mm;
	    	if(dd < 10) dd = '0'+dd;
	    	r_val =  yy + '-' + mm + '-' + dd;
	    	return r_val;
	    }
	},
	route: {
		activate ( transition ) {


			transition.next();
			this.fetch();
			//console.log(this.cdate);
		}
	}
}
</script>
